home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Testing & Debugging / Virtual User tools / SPEC S&L v.1.0.1 / Scripts / Mathematica.vu < prev    next >
Encoding:
Text File  |  1993-12-17  |  7.1 KB  |  199 lines  |  [TEXT/MPS ]

  1. #
  2. # ****************************************************************************
  3. #
  4. #    File Name:        Mathematica.vu
  5. #
  6. #    Contains:    Quick look test script for Mathematica version 2.1
  7. #
  8. #    Written by:    Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
  9. #
  10. #    Copyright:    © 1993 by Apple Computer, Inc., all rights reserved.
  11. #
  12. # ****************************************************************************
  13. #            C h a n g e        H i s t o r y (most recent first):
  14. # ****************************************************************************
  15. #
  16. #        Vers      Date        Author        Description
  17. #        ----    --------    ------    ---------------------------------------------
  18. #     <1.0.7>    11/19/93    NAGA        modify TCS format
  19. #     <1.0.6>     9/30/93    KTA        Initialize gFileName prior to gApptitle being updated by
  20. #                                    launchTwitch().
  21. #     <1.0.5>     9/23/93    KTA        Added 'fpu' to gLaunchReqs as Mathematica requires an FPU.
  22. #     <1.0.2>     6/16/93    NAGA        Renaming InitGlobals(ScriptLevel)to InitGlobals(ScriptLevel)
  23. #        <1+>     5/25/93    NAGA        Adding header and porting old files to follow new standards
  24. #
  25. # ****************************************************************************
  26. #
  27.  
  28.  
  29.  
  30. ########################################################################
  31. #                            External libraries 
  32. #=======================================================================
  33. Libraries "Output.Lib", "DoTasks.Lib","Draw.Lib","UserInterface.Lib", "Font.Lib", "Globals.Lib", "LaunchQuit.Lib", "TCS.Lib";
  34.  
  35.  
  36. #########################################################################
  37. ########               Application Specific Tasks
  38. #########################################################################
  39.  
  40. #########################################################################
  41. #                        InitAppGlobals()
  42. #========================================================================
  43. # Author:        ML
  44. # Description:    Sets up tools and fonts for Mathematica.  This task
  45. #                must be called first.
  46. # Parameters:    None
  47. # Returns:        Nothing
  48. # Examples:        InitAppGlobals()
  49. #========================================================================
  50. # History:
  51. #
  52. ########################################################################
  53. task InitAppGlobals()
  54. begin
  55.     
  56.     logstr("setting up {global gApptitle}'s globals");            
  57.     Println("NOTE: No DoDraw - Mathematica does not have any drawing tools to test.");
  58.     global gScreenInset := {0,20,0,0};        # Screen inset
  59.     
  60.     global gPaletteList :=    {};
  61.     global gToolList := {};
  62.  
  63.         ### font characteristic lists
  64.     global gFontSizeList := {'6','9','10','12','14','18', '24','36','48'};
  65.     global gFontStyleList := {'Bold','Italic','Outline', 'Underline','Shadow'};
  66.  
  67.     
  68.         ### Name of the Plain (style) menu item  ####
  69.     global gPlainStyle := "Plain";            # Plain-Style menu item
  70.  
  71.         ### How to get to the next line
  72.     global gNextLineMethod := 1;            
  73.         ### 1 - ReturnKey,  2 - EnterKey, 3 - DownArrow Key, 4 - TabKey, {} - Move/Click, {'Untitled'} - Move relative to the window titled 'Untitled' /Click
  74.     
  75.         ### Does moving to the next line clear all font info
  76.     global gNextLineClearsFontSettings := 0;                        
  77.  
  78. end; # InitAppGlobals
  79.  
  80.  
  81. #########################################################################
  82. #                            MathStuff()
  83. #========================================================================
  84. # Author:        AEM
  85. # Description:    does some calculation.  Because of its size, Mathematica takes
  86. #                a long time to initialize its calculation routines on the slower
  87. #                cpus.  
  88. # Parameters:    None
  89. # Returns:        Nothing
  90. # Examples:        MathStuff();
  91. # Assumptions:    None 
  92. # Applications:        Mathematica
  93. #========================================================================
  94. # History:
  95. #
  96. #########################################################################
  97. task MathStuff()
  98. begin
  99.     logstr("Performing some calculations...");
  100.     TypeStr("(2135+654654654)/2.3546");
  101.     SpecialKey(enterKey,"Enter Key");
  102.     if not (DialogCheck("",'OK',,{[window t:'Why the Beep?']}))
  103.     begin
  104.         TypeList({"(11+22)*(22*8)","(88*3231)/9.315","((101-145)*32123)/2.32154"},3);
  105.         SpecialKey(enterKey,"Enter Key");
  106.         wait(1);
  107.         while match[window t:/Running≈/]!
  108.             wait(2);
  109.     end;
  110.     else
  111.         LogStr("Sorry, no math tests - No memory, Mathematica couldn't start local kernel");
  112. end;
  113.  
  114. #########################################################################
  115. #                            MathematicaSetupDoText()
  116. #========================================================================
  117. # Author:        KTA
  118. # Description:    Selects LongMenus to set up DoText
  119. # Parameters:    None
  120. # Returns:        Nothing
  121. # Examples:        MathematicaSetupDoText();
  122. # Assumptions:    None 
  123. # Applications:    Mathematica
  124. #========================================================================
  125. # History:
  126. #
  127. #########################################################################
  128. task MathematicaSetupDoText()
  129. begin
  130.     if not(match[menuItem t:'Long Menus' m:[menu t:'Edit' o:3] o:15  c:'']!)
  131.         SelectMenuItem('Long Menus','Edit');
  132. end;
  133.     
  134. #########################################################################
  135. #                            MathematicaPageSetup()
  136. #========================================================================
  137. # Author:        KTA
  138. # Description:    Custom Page Setup
  139. # Parameters:    None
  140. # Returns:        Nothing
  141. # Examples:        MathematicaPageSetup();
  142. # Assumptions:    None 
  143. # Applications:    Mathematica
  144. #========================================================================
  145. # History:
  146. #
  147. #########################################################################
  148. task MathematicaPageSetup()
  149. begin
  150.     if ( WhichDevice = "LaserWriter")
  151.     begin
  152.         TCSStart({ 1, global kTCSetPageSetup },"Select 'Page Setup'");
  153.         TCSEnd({ 1, global kTCSetPageSetup }, SelectMenuItem("Page Setup","Printing Options...","File"));    #To select Page SetUp…
  154.         wait(1);
  155.         PageSetupDesc:= match[window o:1]!;
  156.         PageSetupDescList:= {PageSetupDesc};
  157.         TCSStart({ 2, global kTCSetPageSetup },"Dismiss the Page Setup Dialog");
  158.         SpecialKey(returnKey, 'Return Key');    #To Select the Default-'OK'
  159.         wait(1);
  160.         if not FindWindow(PageSetupDescList)
  161.             TCSEnd({ 2, global kTCSetPageSetup }, 1);
  162.         else
  163.             TCSEnd({ 2, global kTCSetPageSetup }, 0);
  164.     end;
  165. end; # MathematicaPageSetup()
  166.     
  167. ################################################################################
  168. ####################             Main script                    ####################
  169. ################################################################################
  170. script Mathematica (ScriptLevel:= -1)
  171. begin
  172.     InitGlobals(ScriptLevel);            # initialize your general globals
  173.     InitDraw();
  174.     InitFonts();
  175.     global gApptitle := "Mathematica";
  176.     global gAppVersion := '3';        # version of app you will be running
  177.     global gFileName := "@!@-{gBuildVers}-{gAppTitle}";    # This is used in SaveAs when saving files
  178.     global glaunchreqs:= {'no68k', 'fpu'};
  179.     SuiteStart('Mathematica.vu');                    # begin a new test suite
  180.     if LaunchTwitch("{gAppTitle}",gAliasDirectory) # launch or twitch to your app
  181.     begin
  182.         global gSetupDoText:= task MathematicaSetupDoText;    # define app specific task
  183.         InitAppGlobals();                                    # init app specific globals
  184.         (*
  185.         *)
  186.         DoSetUpApp();
  187.         MathStuff();
  188.         DoText();
  189.         DoWindow();        
  190.         DoDraw(0);             
  191.         MathematicaPageSetup();        # custom page setup menuitem
  192.         DoCloseApp(,-1,0);    
  193.     end; # if LaunchTwitch("{gAppTitle}",gAliasDirectory)
  194.     SuiteEnd();
  195. end; # script Mathematica
  196.  
  197. ## Still needed
  198. # 1) Vertical scroll could fail if nothing in document
  199.